package com.mes.basicdata.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.common.domain.BasicModel;

@Entity()
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Table(name = "F_FILE")
@BatchSize(size=30)
@Lazy(value=true)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class FileObject extends BasicModel implements
		java.io.Serializable {
	
	@Id
	@GenericGenerator(name = "fileUid", strategy = "assigned")
	@Column(name="FILEUID",unique=true)
	private String fileUid;

	@Column(name="FILETYPE")
	private String fileType;
	/**
	 * 路径
	 */
	@Column(name="FILEPATH")
	private String filePath;
	/**
	 * 文件名称
	 */
	@Column(name="FILENAME")
	private String fileName;
	/**
	 * 文件上传者所在的部门
	 */
	@Column(name="DEPTID")
	private String deptUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="DEPTID",insertable=false,updatable=false)
	private Dept dept;
	/**
	 * 文件编写者编号
	 */
	@Column(name="FILECREATOR")
	private String AuthorUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="FILECREATOR",insertable=false,updatable=false)
	private Employee Author;
	
	/**
	 * 文件版本
	 */
	@Column(name="VERSION")
	private String version;

	/**
	 * 扩展名，格式
	 */
	@Column(name="FILEFORMAT")
	private String fileFormat;
	
	
	
	@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.getFileUid();
	}
	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.setFileUid(uuid);
	}
	
	public String getFileUid() {
		return fileUid;
	}
	public void setFileUid(String fileUid) {
		this.fileUid = fileUid;
	}
	
	public String getFileType() {
		return fileType;
	}
	public void setFileType(String fileType) {
		this.fileType = fileType;
	}
	
	public String getFilePath() {
		return filePath;
	}
	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}
	
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	
	public String getDeptUid() {
		return deptUid;
	}
	public void setDeptUid(String deptUid) {
		this.deptUid = deptUid;
	}
	
	public Dept getDept() {
		return dept;
	}
	public void setDept(Dept dept) {
		this.dept = dept;
	}
	
	public String getAuthorUid() {
		return AuthorUid;
	}
	public void setAuthorUid(String authorUid) {
		AuthorUid = authorUid;
	}
	
	public Employee getAuthor() {
		return Author;
	}
	public void setAuthor(Employee author) {
		Author = author;
	}
	
	public String getVersion() {
		return version;
	}
	public void setVersion(String version) {
		this.version = version;
	}
	
	public String getFileFormat() {
		return fileFormat;
	}
	public void setFileFormat(String fileFormat) {
		this.fileFormat = fileFormat;
	}


}